public class ThreadDemo5 {
    public static void main(String[] args) throws InterruptedException {
        Thread t=new Thread(() -> {
            while(true)
            {
                //System.out.println("hello t");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }

        });

        //在启动,前获取线程状态 NEW
        System.out.println(t.getState());

        t.start();

        Thread.sleep(2000);
        //线程已经执行完了,Thread对象还在  TERMINATED
        System.out.println(t.getState());
    }
}
